package com.controller;

import com.alibaba.fastjson.JSON;
import com.entity.PostsEntity;
import com.entity.UserEntity;
import com.service.PostsService;
import com.service.serviceImpl.PostsServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.BufferedReader;
import java.io.IOException;
import java.util.List;

@WebServlet("/app/posttest")
public class testPostServlet extends HttpServlet {
    private PostsService postsService = new PostsServiceImpl();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse resp) throws ServletException, IOException {
        String id = request.getParameter("id");
        PostsEntity stringObjectMap = postsService.testPostUser(id);
        String JSONMap = JSON.toJSONString(stringObjectMap);
        System.out.println(stringObjectMap);
        System.out.println("=========");
        System.out.println(JSONMap);
        resp.getWriter().write(JSONMap);
    }
}
